package vaani.internal.actionmanagers;

import java.io.IOException;
import java.util.List;
import vaani.internal.ProcessInstance;
import vaani.internal.ProcessInstanceBash;

/**
 *
 * @author sourcemorph
 */
public class GenericManagerBashType implements ActionManager {

    protected List<ProcessInstance> instances;

    @Override
    public List<ProcessInstance> getProcessInstance() {
        return instances;
    }

    @Override
    public boolean runProcess(int x) {
        try {
            Runtime.getRuntime().exec(((ProcessInstanceBash)instances.get(x)).getCommand());
        } catch(IOException ex) {
            ex.printStackTrace();
            return false;
        }
        return true;
    }

    @Override
    public boolean runProcess() {
        return runProcess(0);
    }
}
